// 封装搜索相关的接口
import axios from '@/utils/request'

/**
 * 获取联想建议
 * @param q 搜索关键字
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getSearchSuggestion = (q) =>
  axios.get('/v1_0/suggestion', {
    params: { q }
  })

/**
 * 获取搜索结果
 * @param page 当前页码
 * @param q 搜索关键字
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getSearchResult = (page, q) =>
  axios.get('/v1_0/search', {
    params: {
      page,
      per_page: 10,
      q
    }
  })
